//--------------------------------------------------------------------
//
//    Copyright (C) Streamlet. All rights reserved.
//
//    File Name:   IME.cpp
//    Author:      Streamlet
//    Create Time: 2015-01-06
//    Description: 
//
//    Version history:
//
//
//--------------------------------------------------------------------



#include "IME.h"
#define XL_LOG_PREFIX _T("[xlUSKeyboard] ")
#define XL_LOG_TARGET_DEBUGGER
#include <xl/App/xlLog.h>


IME::IME()
{
#ifdef _DEBUG
#ifdef _WIN64
    XL_LOG_INFO(_T("Win64 Debug"));
#else
    XL_LOG_INFO(_T("Win32 Debug"));
#endif
#else
#ifdef _WIN64
    XL_LOG_INFO(_T("Win64 Release"));
#else
    XL_LOG_INFO(_T("Win32 Release"));
#endif
#endif
}

IME::~IME()
{

}

STDMETHODIMP IME::Activate(ITfThreadMgr *ptim, TfClientId tid)
{
    if (!AddTextProcessorEngine())
    {
        return E_FAIL;
    }

    return S_OK;
}

STDMETHODIMP IME::Deactivate()
{
    return S_OK;
}

STDMETHODIMP IME::ActivateEx(ITfThreadMgr *ptim, TfClientId tid, DWORD dwFlags)
{
    if (!AddTextProcessorEngine())
    {
        return E_FAIL;
    }

    return S_OK;
}

STDMETHODIMP IME::OnActivated(_In_ REFCLSID clsid, _In_ REFGUID guidProfile, _In_ BOOL isActivated)
{
    if (!AddTextProcessorEngine())
    {
        return E_FAIL;
    }

    return S_OK;
}

bool IME::AddTextProcessorEngine()
{
    return true;
}
